using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;

public class PongEffect : MonoBehaviour
{
    public SpriteRenderer SR;
    private Transform target;
    // Start is called before the first frame update
    void Start()
    {
        SR.color = new Color(1f, 1f, 1f, 0f);

        StartCoroutine(EffectCoroutine());
    }

    public void SetTarget(Transform newTarget)
    {
        target = newTarget;
    }

    IEnumerator EffectCoroutine()
    {
        
        yield return new WaitForSeconds(0.25f);

        SR.color = new Color(1f, 1f, 1f, 1f);

        SR.transform.localScale = SR.transform.localScale * 0.01f;
        SR.transform.DOScale(SR.transform.localScale * 100, 0.15f).SetEase(Ease.OutCubic);
        yield return new WaitForSeconds(0.15f);

        SR.DOFade(0f, 0.1f);
        yield return new WaitForSeconds(0.1f);


        Destroy(gameObject);
    }
}
